package org.example.controller;

import io.swagger.v3.oas.annotations.tags.Tag;
import org.example.mapper.DApartmentMapper;
import org.example.pojo.DApartment;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@CrossOrigin(origins = "*")
@RestController //? @ResponseBody和@controller
@RequestMapping("main")
@Tag(name = "测试数据API",description = "Test Controller")
public class TestController {
    @GetMapping("/Test")
    public String Test(){
        return "test";
    }

    //宿舍房间mapper
    @Autowired
    private DApartmentMapper dApartmentMapper;

    //查找所有的宿舍房间表所有内容
    @GetMapping("/apartments")
    public List<DApartment> selectAll_apartments(){
        List<DApartment> apartments = dApartmentMapper.selectList(null);
        return apartments;
    }
}
